Expressions (chapter 9)

A GrADS expression consists of operators, operands, and parentheses. Parentheses are used the same as in FORTRAN to control the order of operation.

Operators are: + Addition

- Subtraction

* Multiplication

/ Division

Operands are: Variable specifications, functions, and constants.

Operations are done on equivalent grid points in each grid. Missing data values in either grid give a result of a missing data value at that grid point. Dividing by zero gives a result of a missing data value at that grid point.

Operations cannot be done between grids that have different scaling in their varying dimensions -- ie, grids that have different rules for converting the varying dimensions from grid space to world coordinate space. This can only be encountered when you are attempting operations between grids from different files that have different scaling rules.

If one grid has more varying dimensions than the other, the grid with fewer varying dimensions is 'expanded' and the operation is performed.

Some examples of expressions:

z - z(t-1) (Height change over time)

t(lev=500)-t(lev=850) (Temp change between 500 and 850)

ave(z,t=1,t=5) (Average of z over first 5 times in file)

z - ave(z,lon=0,lon=360,-b) (Remove zonal mean)

tloop(aave(p,x=1,x=72,y=1,y=46)) (Time series of globally averaged precip -- assuming 72x46 grid)